if from_cwd {
match pkg.manifest().edition() {
- Edition::Edition2015 => (),
- Edition::Edition2018 => {
- config.shell().warn("To build the current package use 'cargo build', to install the current package run `cargo install --path .`")?;
- },
+ Edition::Edition2015 =>
+ config.shell().warn("To build the current package use `cargo build`, to install the current package run `cargo install --path .`")?
+ ,
+ Edition::Edition2018 =>
+ bail!(
+ "To build the current package use `cargo build`, \
+ to install the current package run `cargo install --path .`, \
+ otherwise specify a crate to install from \
+ crates.io, or use --path or --git to \
+ specify alternate source"
+ )
+ ,
}
};
assert_that(
cargo_process("install").cwd(p.root()),
- execs().with_status(0),
+ execs().with_status(0).with_stderr_contains(
+ "\
+warning: To build the current package use `cargo build`, to install the current package run `cargo install --path .`
+",
+ ),
);
assert_that(cargo_home(), has_installed_exe("foo"));
}
assert_that(
cargo_process("install").cwd(p.root()).masquerade_as_nightly_cargo(),
- execs().with_status(0).with_stderr_contains(
- "\
-warning: To build the current package use 'cargo build', to install the current package run `cargo install --path .`
-",
- ),
+ execs().with_status(101).with_stderr_contains(
+ "error: To build the current package use `cargo build`, \
+ to install the current package run `cargo install --path .`, \
+ otherwise specify a crate to install from crates.io, \
+ or use --path or --git to specify alternate source\
+ "),
);
- assert_that(cargo_home(), has_installed_exe("foo"));
}
#[test]